<template>
    <div>
        <el-breadcrumb separator-class="el-icon-arrow-right">
            <el-breadcrumb-item>首页</el-breadcrumb-item>
            <el-breadcrumb-item>数据统计</el-breadcrumb-item>
            <el-breadcrumb-item>数据报表</el-breadcrumb-item>
        </el-breadcrumb>
        <div id="main" ref="main"></div>
    </div>
</template>

<script>
import * as echarts from 'echarts'
export default {
    async mounted () {
        const myCharts = echarts.init(this.$refs.main)
        const { data: res } = await this.$http.get('reports/type/1')
        if (res.meta.status != 200) return this.$message.error('获取折线图数据失败')
        myCharts.setOption(res.data)
        window.onresize = () => {
            myCharts.resize()
        }
    }
}
</script>

<style lang="less" scoped>
#main {
    margin-top: 40px;
    width: 100%;
    height: 400px;
}
</style>